home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Compression / Opener / Source / builder < prev    next >
Text File  |  1993-07-15  |  1KB  |  43 lines

  1. #! /bin/csh -f
  2. # Attempt to build a directory full of packed comp.sources-type material
  3.  
  4. foreach d ($*)
  5.     cd $d
  6.     echo Trying to unpack and build $d ... >& .errors
  7.     set f = `ls | grep "\.Z"`
  8.     if ("$f" != "") then
  9.     echo "" >>& .errors
  10.         echo Uncompressing *.Z ... >>& .errors
  11.         uncompress *.Z
  12.     endif
  13.     foreach i (*)
  14.         egrep -l "(shell arch|Shell Arch|shar[: ]|unpack.*/bin/sh|sh this file)" $i
  15.         if (! $status) then
  16.         if (! -e archives) then
  17.             mkdir archives
  18.             endif
  19.         echo "" >>& .errors
  20.         echo Unbundling shar archive $i... >>& .errors
  21.         sed '1,/^[:#]/d' $i | /bin/sh >>& .errors
  22.         mv $i archives
  23.         endif
  24.     end
  25.     if (-e Makefile || -e makefile) then
  26.     echo "" >>& .errors
  27.         echo Making $d ... >>& .errors
  28.         make >>& .errors
  29.     else
  30.         set f = `echo $d:t | sed 's/O_//'`
  31.     if (-e $f) then
  32.         set f = O_$f
  33.         endif
  34.         set c = `ls | grep "\.c"`
  35.         if ("$c" != "") then
  36.             echo "Compiling (best guess) ..." >>& .errors
  37.         echo "cc -o $f *.c" >>& .errors
  38.         cc -o $f *.c >>& .errors
  39.         endif
  40.     endif
  41.    mv .errors errors
  42. end
  43.